﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace 软构大作业
{
    public partial class Form7 : Form
    {
        private new AutoAdaptWindowsSize AutoSize;
        protected override CreateParams CreateParams
        {
            get
            {
                CreateParams cp = base.CreateParams;
                cp.ExStyle |= 0x02000000;
                return cp;
            }
        }
        public Form7()
        {
            InitializeComponent();
        }

        private void Form7_FormClosed(object sender, FormClosedEventArgs e)
        {
            Global.Instance.form7login = null;
            Global.Instance.form6login.Show();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Global.Instance.form7login.Hide();
            Global.Instance.form5login.Show();
        }

        private void 图书管理ToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            if(Global.Instance.form9login== null)
            {
                Form9 form9 = new Form9();
                Global.Instance.form9login = form9;
            }
            Global.Instance.form9login.Show();
            Global.Instance.form7login.Hide();
        }

        private void 读者管理ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (Global.Instance.form12login == null)
            {
                Form12 form12 = new Form12();
                Global.Instance.form12login = form12;
            }
            Global.Instance.form12login.Show();
            Global.Instance.form7login.Hide();
        }

        private void 统计分析ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if(Global.Instance.form13login == null)
            {
                Form13 form13 = new Form13();
                Global.Instance.form13login = form13;
            }
            Global.Instance.form13login.Show();
            Global.Instance.form7login.Hide();
        }

        private void 退出ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Global.Instance.form7login.Hide();
            Global.Instance.form6login.Show();
        }

        private void 权限管理ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (Global.Instance.form16login == null)
            {
                Form16 form16 = new Form16();
                Global.Instance.form16login = form16;
            }
            Global.Instance.form16login.Show();
            Global.Instance.form7login.Hide();
        }

        private void 设置规则ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (Global.Instance.form17login == null)
            {
                Form17 form17 = new Form17();
                Global.Instance.form17login = form17;
            }
            Global.Instance.form17login.Show();
            Global.Instance.form7login.Hide();
        }

        private void 借阅ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (Global.Instance.form12login == null)
            {
                Form12 form12 = new Form12();
                Global.Instance.form12login = form12;
            }
            Global.Instance.form12login.Show();
            Global.Instance.form7login.Hide();
        }

        private void Form7_Load(object sender, EventArgs e)
        {
            AutoSize = new AutoAdaptWindowsSize(this);
            this.SizeChanged += new EventHandler(Form_SizeChanged);
        }

        private void Form_SizeChanged(object sender, EventArgs e)
        {//窗体大小改变事件
            if (AutoSize != null) // 一定加这个判断，电脑缩放布局不是100%的时候，会报错
            {
                AutoSize.FormSizeChanged();
            }
        }
    }
}
